<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="../css/list.css">
    <link rel="stylesheet" href="../css/reset.css">
</head>
<body>
    <header></header>
    <section>
        <div id="top">
            <div class="top-con">
                <div class="left">
                    <img src="../image/71596708931610769517.png" alt="">
                </div>
               <div class="middle">
                    <ul>
                            <li><a href="#">全部分类</a></li>
                            <li><a href="#">荣耀Magic V</a></li>
                            <li><a href="#">荣耀60系列</a></li>
                            <li><a href="#">开学季</a></li>
                            <li><a href="#">荣耀数码</a></li>
                    </ul>
               </div>
                <div class="right">
                    <input type="text" placeholder="手机">
                </div>
                
            </div>
            
        </div>
        <div id="list">
            <div class="top">
                <!-- <span class="shou">首页</span>
                <span class="ipad">平板</span> -->
            </div>
            <div class="preparation">
                <p><span>分类：</span><a href="#">平板</a></p>
                <p><span>服务优惠：</span><a href="#">仅看有货</a><a href="#">分期免息</a><a href="#">优惠商品</a></p>
                <p class="last"><span>排序：</span><a href="#">综合</a><a href="#">最新</a><a href="#">评论数</a><a href="#">价格</a><b>￥</b>- <b>￥</b></p>
            </div>
            <div class="show">
                <!-- <div class="box">
                    <a href="list.html">
                    <p><img src="../image/428_428_4B5F030DC030D8D5AB9CB6AF64690FF128254192F950BC58mp.png" alt=""></p>
                    <p>荣耀平板 X7 8英寸</p>
                    <p><span>￥699起</span><b>多款可选</b></p>
                    <p><i>满1000减100</i><strong>限时特价</strong></p>
                    <p><em>37人评价 97%好评</em></p>
                
                </a>
                </div>
                <div class="box">
                    <a href="#">
                    <p><img src="../image/428_428_5644FC57F4C5E4FC95290BD532ADD00B5D355ABCC52AB563mp.png" alt=""></p>
                    <p>荣耀平板 V7 Pro</p>
                    <p><span>￥2199起</span><b>多款可选</b></p>
                    <p><i>满500减50</i><strong>一站式换新</strong></p>
                    <p><em>1046人评价 97%好评</em></p>
                  
                </a>
                </div>
                <div class="box">
                    <a href="#">
                    <p><img src="../image/428_428_6F3981E9B00EE23F225E16D0CFABEEF7BE80713EBF61CC3Bmp.png" alt=""></p>
                    <p>荣耀平板 V7 </p>
                    <p><span>￥1799起</span><b>多款可选</b></p>
                    <p><i>满500减50</i><strong>赠送积分</strong></p>
                    <p><em>345人评价 97%好评</em></p>
                 
                </a>
                </div>
                <div class="box">
                    <a href="#">
                    <p><img src="../image/428_428_8561CFFCDB47F19E65553F5DA0A0DB7D012D2283735B93CAmp.png" alt=""></p>
                    <p>荣耀平板 7 10.1英寸</p>
                    <p><span>￥1099起</span><b>多款可选</b></p>
                    <p><i>满500减50</i><strong>限时特价</strong></p>
                    <p><em>1366人评价 97%好评</em></p>
                 
                </a>
                </div>
                <div class="box">
                    <a href="#">
                    <p><img src="../image/428_428_35EE5D857B65FC1AB3C219B73F4010055C30FF11E532D002mp.png" alt=""></p>
                    <p>荣耀平板 Z3 9.7英寸</p>
                    <p><span>￥1399起</span><b>多款可选</b></p>
                    <p><strong class="mm">赠送积分</strong></p>
                    <p><em >暂无评价</em></p>
                    <h6>暂时缺货</h6>
                </a>
                </div> -->
            </div>
        </div>
    </section>
    <footer></footer>
    
</body>
</html>
<script src="../js/jQuery.js"></script>
<script>
    $("header").load("header.html");
    $("footer").load("footer.html");
</script>
<script>
    $(function(){
        $.get("../goodsAndShoppingCart/getGoodsList.php",{
            typeId:"002"
        },function(data){
            console.log(JSON.parse(data));
            let arr = JSON.parse(data);
            let str = ``;
            arr.forEach((item,index) => {
                // console.log(element.goodsName);
                
                str += `<div class="box item-${index}" id="${item.goodsId}">
                    <a href="#">
                    <p><img src="${item.goodsImg}" alt=""></p>
                    <p>${item.goodsName}</p>
                    <p><span>￥${item.goodsPrice}起</span><b>${item.beiyong1}</b></p>
                    <p><strong class="mm">${item.beiyong2}</strong></p>
                    <p><em >${item.beiyong4}</em></p>
                </a>
                </div>`
            });
            $(".show").html(str);
        })
        $.get("../goodsAndShoppingCart/getGoodsType.php",function(data){
            console.log(data);
            let arr1 = JSON.parse(data);
            console.log(arr1) 
            let arr2 = arr1[2];
            $(".top").html(arr2.goodsType);
        })
    });
    $(".show").on("click","div",function(e){
        if(e.target.tagName == "DIV"){
            // console.log(e.target.id);
            let id = e.target.id;
            location.href = "goods.html?id="+id;
        }
        
    });

</script>